package com.crh.servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class OtherServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		// 获取客户端请求指定的参数值
		String pname = request.getParameter("pname");
		// 解码 组装
		pname = URLDecoder.decode(pname, "UTF-8");
		//对中文乱码问题的解决
		pname = new String(pname.getBytes("ISO8859-1"),"UTF-8");

		String page = request.getParameter("page");

		System.out.println("pname ===== " + pname);
		System.out.println("page ====== " + page);

		PrintWriter out = response.getWriter();
		out.println("This is OtherServlet");
	}

}
